<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<head>
	<jsp:include page="${ctx }/WEB-INF/view/meta.jsp"></jsp:include>
	<script type="text/javascript" src="${ctx}/resource/js/admin/permission.js?r=${random}"></script>
</head>
<body>
	<div class="easyui-panel" data-options="fit:true,height:'100%',title:'权限列表'">
		<!-- DataGrid -->
		<table id="data-grid" class="easyui-treegrid" 
			data-options="fitColumns:true, fit:true, idField: 'id', treeField: 'name',
				toolbar:'#toolbar', url:'/admin/permission/search', onContextMenu:Permission.rightMenu">
			<thead>
		        <tr>
		            <th data-options="field:'name'" style="width: 80px;">权限名称</th>
		            <th data-options="field:'type', formatter:Permission.formatType" style="width: 80px;">权限类型</th>
		            <th data-options="field:'url'" style="width: 80px;">权限内容</th>
		            <th data-options="field:'description'" style="width: 200px;">描述</th>
		        </tr>
		    </thead>
		    <tbody></tbody>
		</table>
	</div>
	<div id="toolbar">
		<a href="javascript:Permission.beforeAdd()" class="easyui-linkbutton" style="width: 120px;" data-options="iconCls:'icon-add'">添加权限模块</a>
	    <a href="javascript:Permission.deletePermission()" class="easyui-linkbutton" data-options="iconCls:'icon-remove'">删除</a>
	    <a href="javascript:Permission.collapse()" class="easyui-linkbutton">折叠所有</a>
	    <a href="javascript:Permission.expand()" class="easyui-linkbutton">展开所有</a>
	</div>
	
	<!-- Add Form -->
	<div id="add-dialog" class="easyui-dialog" style="padding:10px; width: 420px;" 
		data-options="closed:true, title:'编辑', buttons:'#add-dialog-buttons'">
		<form id="add-form" method="post" data-options="novalidate: false">
			<input type="hidden" name="id" />
			<input type="hidden" name="parentId" id="parentId" value="0" />
			<ul class="simple-ul">
				<li>
		        	<label>权限名称：</label>
					<input name="name" class="easyui-textbox add-input" data-options="required:true">
		        </li>
		        <li>
		        	<label>权限类型：</label>
		        	<label><input type="radio" name="type" value="0" />菜单</label>
		        	<label><input type="radio" name="type" value="1" />按钮</label>
		        </li>
		        <li>
		        	<label>权限内容：</label>
					<input name="url" class="easyui-textbox add-input" data-options="required:true">
		        </li>
		        <li>
		        	<label>描述：</label>
					<input name="description" class="easyui-textbox add-input" data-options="required:true">
		        </li>
	        </ul>
	    </form>
	</div>
	<div id="add-dialog-buttons" style="text-align:center;">
		<a href="javascript:Permission.addPermission()" class="easyui-linkbutton c6 search-button" data-options="iconCls:'icon-ok'">提交</a>
    	<a href="javascript:App.closeAddDialog()" class="easyui-linkbutton search-button" data-options="iconCls:'icon-cancel'">取消</a>
	</div>
	
	<!-- 右键菜单 -->
	<div id="rightMenu" class="easyui-menu" style="">
	    <div data-options="iconCls:'icon-add'" onclick="Permission.beforeAddChild()">添加子类别</div>
	    <div data-options="iconCls:'icon-cut'" onclick="Permission.beforeUpdate()">修改类别</div>
	    <div data-options="iconCls:'icon-remove'" onclick="Permission.deletePermission()">删除类别</div>
		<div class="menu-sep"></div>
		<div onclick="Permission.collapse()">折叠所有</div>
		<div onclick="Permission.expand()">展开所有</div>
	</div>
</body>
</html>